home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BBS in a Box 7
/
BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso
/
Files
/
System7 tools
/
Frontier
/
Stack suite.cpt
/
stack suite
/
DocServer Source Text
next >
Wrap
Text File
|
1992-03-11
|
2KB
|
67 lines
Verb stack.create
Syntax stack.create ()
Parameters None.
Action Creates a new “last-in-first-out” stack with no elements in it.
Returns The address of the newly allocated stack object.
Examples scratchpad.nameStack = stack.create ()
« suites.stack.pool.stack1
Notes All stacks are created in a sub-table in the stack suite called "pool".
A stack is a table with two items: top indicates how many elements are currently in the stack; vals is a sub-table that stores the stack values.
See Also stack.push
stack.pop
stack.dispose
stack.visit
Verb stack.push
Syntax stack.push (adrStack, val)
Parameters adrStack is the address of a stack object allocated by stack.create.
val is any valid UserTalk expression.
Action Adds the value at the "top" of the stack.
Returns True.
Examples stack.push (scratchpad.nameStack, "Bull Mancuso")
« true
See Also stack.create
stack.pop
stack.dispose
stack.visit
Verb stack.pop
Syntax stack.pop (adrStack)
Parameters adrStack is the address of a stack object allocated by stack.create.
Action Deletes the top value on the stack and returns it.
Returns The value of the top element on the stack.
Examples stack.pop (scratchpad.nameStack)
« Bull Mancuso
See Also stack.create
stack.push
stack.dispose
stack.visit
Verb stack.visit
Syntax stack.visit (adrStack, callback)
Parameters adrStack is the address of a stack object allocated by stack.create.
callback is the address of a script that will be called for each element in the stack.
Action Calls the callback script for each element in the stack.
Returns True if all the calls to the callback routine returned true.
Examples stack.visit (scratchpad.nameStack, @msg)
« true «displays the value of each stack element in Frontier’s main window.
Notes The callback routine receives exactly one parameter, the value of one of the elements in the stack.
It must return true or false. If it returns false, stack.visit returns false immediately.
See Also stack.create
stack.push
stack.pop
stack.dispose
Verb stack.dispose
Syntax stack.dispose (adrStack)
Parameters adrStack is the address of a stack object allocated by stack.create.
Action Deletes the table storing the stack object.
Returns True.
Examples stack.dispose (scratchpad.nameStack)
« true
See Also stack.create
stack.push
stack.pop
stack.visit